/*  
 *  Copyright 2006 Paul Jack.
 *
 *  This file is part of the Dex compiler suite. 
 *  
 *  Dex is free software; you can redistribute it and/or modify it
 *  under the terms of the GNU General Public License as published by the
 *  Free Software Foundation; either version 2 of the License, or (at your
 *  option) any later version.
 *  
 *  Dex is distributed in the hope that it will be useful, but
 *  WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
 *  Public License for more details.
 *  
 *  You should have received a copy of the GNU General Public License along
 *  with this program; if not, write to the Free Software Foundation, Inc.,
 *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
 */
package dex.compiler.model.expression;

import java.util.List;

import dex.compiler.model.base.Place;


/**
 * An indirect function call, such as <code>x\()</code>. 
 * An indirect function call invokes a function via a function pointer.
 */
public class IndirectCall extends Call {


	/**
	 * The owner of this call. 
	 */
	private Expression owner;


	/**
	 * Constructs a new call node.
	 * 
	 * @param place   The place where the call node originated
	 * @param owner   The owner of the call
	 * @param parameters   The parameters to send to the call
	 */
	public IndirectCall(Place place, Expression owner, List<Expression> parameters) {
		super(place, parameters);
		if (owner == null) {
			throw new IllegalArgumentException();
		}
		this.owner = owner;
	}

	
	@Override
	public String toString() {
		return owner + "\\(" + listToString(getParameters()) + ")";
	}
	
	
	/**
	 * Returns the owner of this call node.
	 * 
	 * @return the owner
	 */
	public Expression getOwner() {
		return owner;
	}

	
}
